<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>活动管理</title>
<link rel="stylesheet" href="../common/kindeditor-4.1.10/themes/default/default.css" />
<script charset="utf-8" src="../common/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="../common/kindeditor-4.1.10/lang/zh_CN.js"></script>
<%@ include file="../common/importLib.jsp" %>
<script type="text/javascript" src="../common/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="../common/jquery-cascade/js/jquery.cityselect.js"></script>
<script type="text/javascript">
	/**
	 * 增删改查参数设置
	 */ 
	tableTitle = "活动表";
	tableURL = getTimeURL("activity/activityList.do");
	toolbarView = 2;
	tableColumns = [[{field:'ck',checkbox:true},
	                {field:'id',title:'id',width:0,rowspan:1},
					{field:'opt',title:'操作',width:180,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){	
							var queryUrl = 'activity/queryById.do?id=' + rowData.id;						
							return "<a title='修改' class='xxl_linkbutton' iconCls='icon-edit' href='javascript:datagridUpdate(\"" + queryUrl + "\")'>修改</a>";
							
						}
					},	
					{field:'name',title:'标题',width:200,rowspan:1},
	               
				
					{field:'updateDate',title:'发布日期',width:100,rowspan:1},
					
					{field:'disableFlag',title:'禁用状态',width:80,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.disableFlag == 0){
								return "<font color='green'>起用</font>";
							}else{
								return "<font color='red'>禁用</font>";
							}
						}
					}]];
	
	
	var addWidth = 800; //添加窗口宽度
	var addHeight = 550; //添加窗口高度
	var addTitle = "添加活动"; //添加标题
	var updateWidth = 800; //修改窗口宽度
	var updateHeight = 550; //修改窗口高度
	var updateTitle = "修改活动信息"; //修改标题
	var updateDisableFlagUri = "activity/updateDisableFlag.do"; //禁用、起用记录
	var deleteUri = "activity/deleteByIds.do"; //删除记录
	
	/**
	 * 初始化添加表单
	 */	
	function initAddForm(){	
		//openPicUpload();			
		addFormProcess("name","成员",true);
		baseFormValidator("name","标题",2,40);
		//baseFormValidator("content","活动内容");
		
	}
	
	/**
	 * 初始化修改表单
	 */
	function initUpdateForm(jsonObject){		
		
		
		
		$("#nameUpdate").val(jsonObject.name);
		$("#contentUpdate").val(jsonObject.content);
		$("#idUpdate").val(jsonObject.id);	
		editorUpdate.html(jsonObject.content);
		
		updateFormProcess("nameUpdate","标题");	
		baseFormValidator("nameUpdate","标题",2,40);
	}
	
	

	
</script>


</head>
<body id="layout" class="easyui-layout">
	 
	 <div style="background: none repeat scroll 0% 0% #EFEFEF; height:75px; padding: 6px 2px; border-bottom: 1px solid #CCC;"
			region="north"  split="false" title="条件查询">
		<form  id="searchForm" >
		<table>
			<tr>
				<td>活动标题：</td><td><input type="text" name="name"/> </td>			
				<td width="50px;"></td>
						
				<td width="50px;"></td>
				<td><a class="easyui-linkbutton" id="search" iconCLs="icon-search"  onclick="searchTable()">搜索</a></td>
				<td><a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('searchForm').reset();reload();">清空</a></td>
			</tr>
		</table>
		</form>
	</div>
	<div region="center">
	
	<table id="datagrid_table"></table> 
	<!-- 添加记录	 -->
	<div id="datagrid_add">
	  
		 <form id="add_form" action="activity/addActivityInfo.do" method="post">
			
			<table width="100%" class="xxl_tb_1">
				<tbody>	
					
					<tr>
						<td class="xxl_td_2" >活动标题：</td>
						<td ><input type="text" id="name" name="name" /></td>
						<td><div id="nameTip" style="width:350px"></div></td>
					</tr>
					<!-- <tr>
						<td class="xxl_td_2" >活动类型：</td>
						<td >
						<select name="typeId" size="1" id="typeId" style=" font-size:14px; font-family:'宋体',; color:#999;">      			
      						<option value=""></option>
      					</select>
						</td>
						
					</tr> -->
					<tr>
						<td class="xxl_td_2">活动内容：</td>
						<td colspan="2"><textarea id="content" name="content" class="kindeditor" style="width:600px;height:300px;"></textarea></td>	
											
					</tr>
					
					
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#add_form').submit();">添加</a>
							<a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('add_form').reset()">重置</a>
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_add').window('close');">取消</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form> 
	</div>
	
	<!-- 修改记录 -->
	<div id="datagrid_update">
		<form id="update_form" action="activity/updateById.do" method="post">
			<input type="hidden" id="idUpdate" name="id"/>
			
			<table width="100%" class="xxl_tb_1">
				<tbody>										
					<tr>
						<td class="xxl_td_2">姓名：</td>
						<td><input type="text" id="nameUpdate" name="name"/></td>
						<td><div id="nameUpdateTip" style="width:350px"></div></td>
					</tr>
					
					<tr>
						<td class="xxl_td_2">个人介绍：</td>
						<td  colspan="2"><textarea id="contentUpdate" name="content" class="kindeditor2" style="width:600px;height:300px;"></textarea></td>
					
					</tr>
					
					<tr>
						<td colspan="3" style="text-align: center">
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#update_form').submit();">修改</a>		
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_update').window('close');">取消</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
	</div> 
</body>
</html>